﻿using AntMovement.Core.Enum;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;

namespace AntMovement.WPF.Converter.Status
{
    [ValueConversion(typeof(StatusDeviceType), typeof(Brush))]
    public class DeviceStatusToColorConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            int i = System.Convert.ToInt32(value);
            switch (i)
            {
                case 1:
                    return new SolidColorBrush(Color.FromArgb(0xFF, 0x5F, 0x5F, 0x5F));//设备手动--待机
                case 2:
                    return new SolidColorBrush(Color.FromArgb(0xFF, 0x19, 0xD0, 0x2D));//设备自动运行
                case 3:
                    return new SolidColorBrush(Color.FromArgb(0xFF, 0xDC, 0x21, 0x21));//设备报警
                case 4:
                    return Brushes.DeepSkyBlue;//设备暂停
                case 5:
                    return new SolidColorBrush(Color.FromArgb(0xFF, 0xFB, 0xDC, 0x0B));//停机维修
                case 6:
                case 7:
                case 8:
                    return Brushes.Black;//待料,堵料
            }
            return new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0xCE, 0x51));
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
